#ifndef BATMINTON_H
#define BATMINTON_H

#include <QMainWindow>
#include <QWidget>
#include <QTimer>
#include <QPainter>
#include <QKeyEvent>
#include "player.h"
#include "ball.h"

QT_BEGIN_NAMESPACE
namespace Ui { class Batminton; }
QT_END_NAMESPACE

class Batminton : public QMainWindow
{
    Q_OBJECT

public:
    Batminton(QWidget *parent = nullptr);
    ~Batminton();

private slots:
    void on_buttonStart_clicked();
    void on_buttonReset_clicked();
private:
    Ui::Batminton *ui;
    QTimer *myTimer;
    Player *player[2];
    Ball *ball;
    int score[2];
int K;
    void drawboard();
    void GameCalculate();
    void Shoot();
    void Moveball();
    void Moveplayer();
    void Positioncheck();
    void Ballupdate();
protected:
    void keyPressEvent(QKeyEvent *event);
    void keyReleaseEvent(QKeyEvent *event);
};
#endif // BATMINTON_H
